<?php
use think\facade\Route;

/* 课程管理 */
Route::group('teacher/course', function () {
    Route::get('<type>',            '@getTeacherCourse');
    Route::post('add',              '@addCourse');
    Route::group('<id>', function() {
        Route::get('edit',          '@editCourse');
        Route::put('edit',          '@editCourse');
        Route::put('finish',        '@finishCourse');   // 完结课时
        Route::put('close',         '@closeCourse');
        Route::put('open',          '@openCourse');
        Route::delete('delete',     '@deleteCourse');
    })->pattern(['id' => '\d+']);
})->prefix('\app\user\service\teacher\TeacherCourse');

// 课时管理
Route::group('teacher/course/<id>/section', function () {
    Route::get('tree$',             '@getCourseSectionTree');
    Route::get('level$',            '@getCourseSectionLevel');

    Route::group('<pid>', function() {
        Route::post('data',         '@addCourseSectionData');
        Route::post('menu',         '@addCourseSectionMenu');
    })->pattern(['pid' => '\d+']);

    Route::group('<sid>', function() {
        Route::get('data',          '@getCourseSectionData');
        Route::put('data',          '@editCourseSectionData');
        Route::put('menu',          '@editCourseSectionMenu');
        Route::delete('delete',     '@deleteCourseSection');
    })->pattern(['sid' => '\d+']);
})->prefix('\app\user\service\teacher\TeacherCourse')->pattern(['id' => '\d+']);


